// JavaScript Document
/**
*	显示会员详细地址
**/
function show_member_address(province_id,city_id,district_id,address,show_id){
	var	p_str		=	get_pcd_address(province_id,0,0);
	var	c_str		=	get_pcd_address(0,city_id,0);
	var	d_str		=	get_pcd_address(0,0,district_id);
	var	addr_str	=	p_str+c_str+d_str+' '+address;
	$("#"+show_id).html(addr_str);
}

/**
*	选中会员已有地址
**/
function member_address_click(obj,address_id){
	$("#true_address_div dl").attr('class','address_box');
	$(obj).attr('class','address_box address_box_on');
	$("#address_id").val(address_id);
}

/**
*	已有地址和新地址的切换
**/
function news_address_click(){
	var news_address	=	$("input[name=news_address]:checked").val();
	if(news_address	==	'y'){
		$("#true_address_div").css('display','none');
		$("#false_address_div").css('display','block');
	}else{
		$("#true_address_div").css('display','block');
		$("#false_address_div").css('display','none');
	}
}

/**
*	米淘乐联系快递的选择
**/
function	express_true_click(){
	var express_true	=	$("input[name=express_true]:checked").val();
	if(express_true	==	'y'){
		$("#div_addr").css('display','block');
	}else{
		$("#div_addr").css('display','none');
	}
}

/**
*	米淘乐联系快递的选择
**/
function	express_true_click(){
	var express_true	=	$("input[name=express_true]:checked").val();
	if(express_true	==	'y'){
		$("#div_addr").css('display','block');
	}else{
		$("#div_addr").css('display','none');
	}
}

/**
*	是否同意回购协议
**/
function	iftrue_click(){
	var n	=	$("input[name=iftrue]:checked").length;
	if(n > 0){
		$("#sub_btn_order").attr('class','input_btn2');
		$("#sub_btn_order").attr('disabled',false);	
	}else{
		$("#sub_btn_order").attr('class','input_btn2');
		$("#sub_btn_order").attr('disabled','disabled');	
	}
}

/**
*	订单提交
**/
function check_from_order(){
	var 	news_address	=	$("input[name='news_address']:checked").val();
	if(news_address	==	'n'){
		var address_id		=	$("#address_id").val();
		if(address_id	==	0){
			alert("请选择选择常用地址");
			return false;
		}
	}else{
		if($.trim($("#link_name").val()) == ''){
			alert("请输入联系人");
			$("#link_name").focus();
			return false;
		}
		
		if(!check_mobile($("#mobile").val())){
			alert("手机号码有误！");
			$("#mobile").focus();
			return false;
		}
	
		if($.trim($("#province").val()) == 0){
			alert("请选择省份");
			$("#province").focus();
			return false;
		}
		
		if($.trim($("#city").val()) == 0){
			alert("请选择城市");
			$("#city").focus();
			return false;
		}
		
		if($.trim($("#district").val()) == 0){
			alert("请选择区县");
			$("#district").focus();
			return false;
		}
		
		if($.trim($("#address").val()) == ''){
			alert("请输入详细地址");
			$("#address").focus();
			return false;
		}
		
		//选择回购网联系快递　
		if($("input[name='express_true']:checked").val()=='y'){
			if($.trim($("#stime").val()) == ''){
				alert("请输入上门取件时间");
				$("#stime").focus();
				return false;	
			}else if($.trim($("#etime").val()) == ''){
				alert("请输入上门取件时间");
				$("#etime").focus();
				return false;	
			}
		}
	}
	
	$("#sub_btn_order").attr('disabled','disabled');	//防止网络延迟重复提交
	$("#myFrom").submit();
}
